home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 031a / owlbwcc.zip / BWRADELY.CPP < prev    next >
C/C++ Source or Header  |  1992-02-02  |  4KB  |  114 lines

  1. /**********************************************************************/
  2. /*                  BWRADELY.cpp by Bob Bourbonnais                   */
  3. /*              released to the public domain 2/2/92                  */
  4. /*          This program shows how to process radio buttons           */
  5. /*         using the SendDlgItemMsg style of button processing.       */
  6. /**********************************************************************/
  7. #include <owl.h>
  8. #include <dialog.h>
  9. #include "bwcc.h"                        // needed for BWCC
  10. #include "bwradely.h"
  11.  
  12. class TMyDialog : public TDialog
  13.   {
  14.   public:
  15.     TMyDialog(LPSTR lpDialogName)          // constructor calls
  16.       : TDialog(NULL,lpDialogName)         // base class constructor
  17.       {
  18.       BWCCGetVersion();    // activate Borland Windows Custom Controls
  19.       }
  20.     virtual void Ok(RTMessage Msg);        // redefines the DDVT function
  21.                        // for the OK button #1
  22.                        // as defined in Base class
  23.                        // TDialog
  24.     virtual void DefChildProc(RTMessage Msg); // default button handler
  25.   };
  26.  
  27. void TMyDialog::Ok(RTMessage Msg)  // Redefines button handler inherited
  28.   {                                // from TDailog for Button #1 IDOK
  29.   char szMyString[180];
  30.  
  31.   if (SendDlgItemMsg(IDB_UNIT12_TEST,BM_GETCHECK,0,0))  // check on button
  32.     {                                                   // status
  33.     lstrcpy(szMyString,"Unit #12 is in Test Mode.\n");
  34.     }
  35.   else if (SendDlgItemMsg(IDB_UNIT12_PHASE1,BM_GETCHECK,0,0))
  36.     {
  37.     lstrcpy(szMyString,"Unit #12 is in Phase 1 of Operation.\n");
  38.     }
  39.   else if (SendDlgItemMsg(IDB_UNIT12_PHASE2,BM_GETCHECK,0,0))
  40.     {
  41.     lstrcpy(szMyString,"Unit #12 is in Phase 2 of Operation.\n");
  42.     }
  43.   else
  44.     {
  45.     lstrcpy(szMyString,"Unit #12 is in Phase 3 of Operation.\n");
  46.     }
  47.  
  48.   if (SendDlgItemMsg(IDB_UNIT13_TEST,BM_GETCHECK,0,0))  // check on button
  49.     {                                                   // status
  50.     lstrcat(szMyString,"Unit #13 is in Test Mode.\n");
  51.     }
  52.   else if (SendDlgItemMsg(IDB_UNIT13_PHASE1,BM_GETCHECK,0,0))
  53.     {
  54.     lstrcat(szMyString,"Unit #13 is in Phase 1 of Operation.\n");
  55.     }
  56.   else if (SendDlgItemMsg(IDB_UNIT13_PHASE2,BM_GETCHECK,0,0))
  57.     {
  58.     lstrcat(szMyString,"Unit #13 is in Phase 2 of Operation.\n");
  59.     }
  60.   else
  61.     {
  62.     lstrcat(szMyString,"Unit #13 is in Phase 3 of Operation.\n");
  63.     }
  64.  
  65.   BWCCMessageBox(HWindow,szMyString,"Update on Unit #12",MB_OK); //output
  66.                                  //status
  67.   TDialog::Ok(Msg);     //default OK handler to close dialog box
  68.   }
  69.  
  70. void TMyDialog::DefChildProc(RTMessage Msg)   // default button handler
  71.   {
  72.   if ((Msg.WParam >= IDB_UNIT12_TEST)&(Msg.WParam <= IDB_UNIT13_PHASE3))
  73.     {          // If a radio button is pressed then
  74.     TDialog::DefChildProc(Msg);  // pass message along to base class
  75.     }                            // to check the box
  76.   else
  77.     {
  78.     MessageBeep(0);                             // make sound and display
  79.     BWCCMessageBox(HWindow,"Not Implemented",   // a BWCC message box
  80.            "Feature",MB_OK);
  81.     TDialog::DefChildProc(Msg);                 // pass messages along
  82.     }                                           // to base class handler
  83.   }
  84.  
  85. class TDialog1App : public TApplication  // Application Class to contain
  86.   {                                      // the application
  87.   public:
  88.     TDialog1App(LPSTR lpName, HANDLE hInstance,  // constructor calls the
  89.         HANDLE hPrevInstance,            // base class constructor
  90.         LPSTR lpCmdLine, int nCmdShow)
  91.         :TApplication(lpName, hInstance,
  92.                   hPrevInstance,
  93.                   lpCmdLine, nCmdShow) {};
  94.  
  95.     virtual void InitMainWindow(); // overrides base class InitMainWindow
  96.   };
  97.  
  98. void TDialog1App::InitMainWindow() // to initialize a dialog box
  99.   {                                // as the main window
  100.   MainWindow = new TMyDialog("MAINWINDOWDIALOG");
  101.   }
  102.  
  103. int PASCAL WinMain(HANDLE hInstance,              // main entry point from
  104.            HANDLE hPrevInstance,          // windows to this program
  105.            LPSTR lpCmdLine , int nCmdShow)
  106.   {
  107.   TDialog1App Dialog1("Dialog Tester",hInstance,  // create instance of
  108.                hPrevInstance,             // the dialog application
  109.                lpCmdLine,nCmdShow);
  110.   Dialog1.Run();                                  // run it
  111.   return (Dialog1.Status);                        // exit
  112.   }
  113. /**********************************************************************/
  114.